
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 
<%@ include file="/include/head.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="<%=request.getContextPath()%>/resources/servicePro/jquery.uploadify.min.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/resources/servicePro/uploadify.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
      $(function(){  
      
        $("#file_upload").uploadify({
        		    'buttonText' : '请选择资料库图片',
        		    'height' : 30,
        	        'swf' : '<%=request.getContextPath()%>/resources/servicePro/uploadify.swf',
        	        'uploader' : '<%=request.getContextPath()%>/back/actBack/upload.do?type=zlk',
        	        'width' : 120,
        	        'multi'           : false,
                    "auto"            : false,
                    "dnd"             : true,
        	        "fileTypeExts"    : "*.png;*.jpg;*.bmp;*.gif",
                    "fileSizeLimit"   : "2MB",
        	        'fileObjName'   : 'file',
        	        'onUploadSuccess' : function(file, data, response) {
        	        	      data = eval("(" + data + ")");      	        
        	                 alert( file.name + ' 上传成功！ ');
                           $("#iphoto").val(data.picurl);
                            $("#picShow").attr('src','<%=imgPath %>'+data.picurl); 
                            $("#iifUpPic").val("1");
        	            $("#uploadButton").hide();
        	            
        	        },
         'onFallback' : function() {
           alert('Flash was not detected.');
        },
         "onSelect" : function(file) {
          if ($("#file_upload-queue").children().length == 2) {
            $("#uploadButton").show();
          } else {
            $("#uploadButton").show();
          }
        },
           "onCancel" : function() {
          if ($("#file_upload-queue").children().length == 2) {
            $("#uploadButton").show();
          } else if ($("#file_upload-queue").children().length == 2) {
            $("#uploadButton").show();
          } else {
            $("#uploadButton").show();
          }
        },
 		        });
 		        
 		               $("#file_upload1").uploadify({
        		    'buttonText' : '请选择图片',
        		    'height' : 30,
        	        'swf' : '<%=request.getContextPath()%>/resources/servicePro/uploadify.swf',
        	        'uploader' : '<%=request.getContextPath()%>/back/actBack/uploadpic.do?type=zlk',
        	        'width' : 120,
        	        'multi'           : true,
                    "auto"            : true,
                    "dnd"             : true,
        	        "fileTypeExts"    : "*.png;*.jpg;*.bmp;*.gif",
                    "fileSizeLimit"   : "2MB",
        	        'fileObjName'   : 'file',
        	        'onUploadSuccess' : function(file, data, response) {
        	        	      data = eval("(" + data + ")");      	       
        	                 alert( file.name + ' 上传成功！ ');
        	                 var s="<input type='hidden'   name='bpicUrl' value='"+data.picurl+"' />"+"<input type='hidden'   name='spicUrl' value='"+data.picurl1+"' /> "+
        	                 "<IMG   width='50' height='50' src='<%=imgPath %>"+data.picurl1+"'/>";
        	                 $("#content").append(s);
                            $("#iifUpPic1").val("1");
        	            $("#uploadButton1").hide();
        	            
        	        },
         'onFallback' : function() {
           alert('Flash was not detected.');
        },
         "onSelect" : function(file) {
          if ($("#file_upload-queue").children().length == 2) {
            $("#uploadButton1").show();
          } else {
            $("#uploadButton1").show();
          }
        },
           "onCancel" : function() {
          if ($("#file_upload-queue").children().length == 2) {
            $("#uploadButton1").show();
          } else if ($("#file_upload-queue").children().length == 2) {
            $("#uploadButton1").show();
          } else {
            $("#uploadButton1").show();
          }
        },
 		        });
 		        
    	  $("#add_manager_dialog").dialog({
		    autoOpen : false,
		    width : 750,
		    draggable : true,
		    resizable : false,
		    height:500,
		    buttons : [ {
		      text : "提交",
		      click : function() {
		      	  addManager();
		     	 $(this).dialog("close");		      	
		      }
		    }, {
		      text : "取消",
		      click : function() {
		        $(this).dialog("close");
		        
		      }
		    } ]
	  });
	  
	     /**加载修改活动框**/
		  $("#update_manager_dialog").dialog({
		    autoOpen : false,
		    width : 700,
		    draggable : true,
		    resizable : false,
		    height:550,
		    buttons : [ {
		      text : "提交",
		      click : function() {
		      	  updateManager();
		     	 $(this).dialog("close");		      	
		      }
		    }, {
		      text : "取消",
		      click : function() {
		        $(this).dialog("close");
		        
		      }
		    } ]
	  });
	        $("#add_manager").click(function(e) {
	        closeOtherJDialog();
	        e.stopPropagation();
	        $("#zidupdate").val("1");
	        $("#add_manager_dialog").dialog('open');
	     });
        $(".list_table").colResizable({
          liveDrag:true,
          gripInnerHtml:"<div class='grip'></div>", 
          draggingClass:"dragging", 
          minWidth:30
        }); 
        
        
        
      }); 
        
        //update
    function openupdate(pkey,pvalue){
        closeOtherJDialog();
        $("#key").val(pkey);
        $("#value").val(pvalue);
	    $("#update_version_dialog").dialog('open');
	  }
  /**添加活动信息**/
     function addManager(){
	     $("#save").get(0).submit();
     }
     function updateManager(){
     $("#savepic").get(0).submit();
     }
     function addpic(id){
     	  closeOtherJDialog();
	        $("#zid").val(id);
	        $("#update_manager_dialog").dialog('open');
     }
     function updatezlk(id,pic,desc,title,eff,up){
     	  closeOtherJDialog();
	        $("#zidupdate").val(id);
	         $("#iployDesc").val(desc);
	          $("#iphoto").val(pic);
	         $("#picShow").attr("src","<%=imgPath %>"+pic);
		 $('#title').val(title);
		 if(up > 1000){
			 $("input[name='up'][value='true']").attr("checked","checked");
		 }else{
			 $("input[name='up'][value='false']").attr("checked","checked");
		 }
		 $("input[name='eff'][value='"+eff+"']").attr("checked","checked");
	        $("#add_manager_dialog").dialog("option","title", "修改高清资料库").dialog('open');
     }
     function querypic(id){
     	window.location.href="<%=request.getContextPath()%>/back/student/querypic.do?name=9&schoolId="+id;
     }
   </script>
<title>高清资料库管理</title>


</head>
<body  >
	<div class="container">
		<div class="main_top">

			<div class="main_right fr span10">

				<div class="box pl5">
					<div class="box_border">
						<div class="box_top">
							<div class="box_top_l fl">
								<b class="pl15">数据</b>
							</div>
						</div>
						<form id="form1" method="post" action="<%=request.getContextPath()%>/back/student/queryzlk.do">
								<div class="searchDiv fl">
						
									<b>请输入资料库名称进行搜索</b>
									 <input type="text" name="name" class="input-text lh30" style="width:300px" maxlength="50" value="${PageBean.name }">  
									
									 <input type="submit" value="搜索" class="btn btn82 btn_search">

								</div>
						
								<div class="searchDiv fr">
								<input type="button"  id="add_manager"  class="new_btn new_btn_publish new_btn_big" 
											value="添加资料库">
									    
								</div>
							</form>
						<div class="box_center">
							<div id="table" class=" fl mt10">
								<div class="box span10 oh">
									<table width="100%" border="0" cellpadding="0" cellspacing="0"
										class="list_table">
										<tr>
											<th width="1.5%">序号</th>
											<th width="5%">标题</th>
											<th width="7%">默认图片</th>
											<th width="5%">描述</th>
											<th width="5%">创建时间</th>
											<th width="5%">操作</th>
										</tr>
										 <c:if test="${fn:length(list)==0}"><tr class="tr"><td align="center" colspan="5">暂无数据</td> </tr></c:if>
										<c:if test="${fn:length(list)>0}">
										<c:forEach items="${list}" var="manager" varStatus="abc">
											<tr class="tr">
											    <td align="center"><c:out value="${(PageBean.currentpage-1)*PageBean.pagesize+abc.index + 1}" /></td>
												<td align="center"><c:out value="${manager.title}" /></td>
												<td align="center"><a href="<%=imgPath %>${manager.zsmall}" data-lightbox="image-1"  > <IMG   width="50" height="50" src="<%=imgPath %>${manager.zsmall}"/></a></td>
												<td align="center"><c:out value="${manager.zdesc}" /></td>
												<td align="center"><c:out value="${manager.ztime}" /></td>
												<td align="center"><input type="button" class="new_btn new_btn_up" onclick="updatezlk('${manager.zid}','${manager.zsmall}','${manager.zdesc}','${manager.title}',${manager.eff},${manager.up});" value="更新">
												 <input type="button" class="new_btn new_btn_up" onclick="addpic('${manager.zid}')" value="添加图片"> 
												  <input type="button" class="new_btn new_btn_up" onclick="querypic('${manager.zid}')" value="查看图片">
												   </td>
											</tr>
										</c:forEach>
                                     </c:if>
									</table>
									<div class="fr fontblack mt25 mb20 mr20">
										每页条数：<a href="<%=request.getContextPath()%>/back/student/queryzlk.do?pz=5"
											class="${pageSize == 5 ? 'fontpink' : ''}">5</a> | <a
											href="<%=request.getContextPath()%>/back/student/queryzlk.do?pz=10"
											class="${pageSize == 10 ? 'fontpink' : ''}">10</a> | <a
											href="<%=request.getContextPath()%>/back/student/queryzlk.do?pz=20"
											class="${pageSize == 20 ? 'fontpink' : ''}">20</a>
									</div>
									<div class="fr fontblack mt5 mb20 mr20">
										<jsp:include page="../template/commonPagination.jsp">
											<jsp:param name="url" value="query.do?"></jsp:param>
										</jsp:include>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>

			<div class="clear"></div>
		</div>

	</div>
	
	 <!-- 添加分类dialog start -->
	<div id="update_version_dialog" title="更新系统参数信息" style="display:none;">
		<div class="box span10 oh">
			<table class="list_table"  id="tb_version_update" >
	            <tr class="tr">
					<td align="center">value:</td>
					<td><input type="text" id="value" name="value" class="input-text lh30" style="width:300px" maxlength="150">
					   <input type="hidden" id="key" name="key">
					</td>
				</tr><tr class="tr">
			</table>
		</div>
		</div>
		
			<div id="add_manager_dialog" title="添加高清资料库" style="display:none;">
		<div class="box span10 oh">
		<form action="<%=request.getContextPath()%>/back/student/savezlk.do" method="post" id="save">
			<table class="list_table"  id="tb_version_update" >
				
				<tr class="tr">
					<td align="left" width="110">&nbsp;&nbsp;资料库图片:</td>
					<td>
					<div> <input type="hidden" id="zidupdate"  name="zlkId" />
							<input type="file" name="fileName" class="ml10" style="height:36px;" id="file_upload" /> 
							<input id="uploadButton" type="button"
								onclick="$('#file_upload').uploadify('upload');" value="开始上传"
								class="ext_btn ext_btn_success" style="display:none;">
							<p class="fontpink" id="onlyOneImg" style="display:none;">只能上传一张图片</p>
							<IMG   width="50" height="50" id="picShow" src=""/>
							<input type="text" id="iphoto"  name="picUrl" />
							<input type="hidden" id="iifUpPic"   value="0" />
							</div>
                    </td>
				</tr>
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;资料库标题:</td>
					<td><input  name="title"  class="ml10" style="height:36px;" id="title" />  </td>
				</tr>
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;是否置顶:</td>
					<td><input type="radio" name="up" value="true">置顶 <input type="radio" name="up" value="false" checked>取消置顶 </td>
				</tr>
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;是否显示:</td>
					<td><input type="radio" name="eff" value="1" checked>显示 <input type="radio" name="eff" value="0">不显示 </td>
				</tr>
				 <tr class="tr">
					<td align="left">&nbsp;&nbsp;资料库描述:</td>
					<td><textarea   id="iployDesc" class="input-text_popup_form pl10 ml10" name="zlkDesc"
						style="height:100px;width:90%;"></textarea></td>
				</tr>
				 
				 
			</table>
			</form>
		</div>
		</div>
		
		<!-- 修改活动信息 -->
		<div id="update_manager_dialog" title="添加图片" style="display:none;">
		<div class="box span10 oh">
		<form action="<%=request.getContextPath()%>/back/student/savepiccontent.do" method="post" id="savepic">
		<input type="hidden" id="zid"  name="iObj_id" />
		<input type="hidden" id="info"  name="picOne" value="zlk" />
			<table class="list_table"  id="tb_version_update" >
					<tr class="tr">
					<td align="left" width="110">&nbsp;&nbsp;资料库图片:</td>
					<td>
					<div>
							<input type="file" name="fileName1" class="ml10" style="height:36px;" id="file_upload1" /> 
							<input id="uploadButton1" type="button"
								onclick="$('#file_upload1').uploadify('upload');" value="开始上传"
								class="ext_btn ext_btn_success" style="display:none;">
							 <div id="content"></div>
							<input type="hidden" id="iifUpPic1"   value="0" />
							</div>
                    </td>
				</tr>
				 <tr class="tr">
					<td align="left">&nbsp;&nbsp;资料库描述:</td>
					<td><textarea    class="input-text_popup_form pl10 ml10" name="ipic_desc"
						style="height:100px;width:90%;"></textarea></td>
				</tr>
				 
				 
			</table>
			</form>
		</div>
		</div>
		
</body>

</html>
